
// CelsusView.h : interface of the CCelsusView class
//


#pragma once
#include "CelsusDoc.h"
#include "explorer_window.h"
#include "DlgRequestView.h"

class CCelsusView : public CFormView
{
protected: // create from serialization only
	CCelsusView();
	DECLARE_DYNCREATE(CCelsusView)

public:
	enum{ IDD = IDD_CELSUS_FORM };

// Attributes
public:
	CCelsusDoc* GetDocument() const;

// Operations
public:

// Overrides
public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);

	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnInitialUpdate(); // called first time after construct

	afx_msg void OnLvnOdcachehintListRequests(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnLvnGetdispinfoListRequests(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnNMCustomdrawListRequests(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnLvnItemchangedListRequests(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnNMClickListRequests(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnTcnSelchangeTabCtrl(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnHdnItemclickListRequests(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnLvnKeydownListRequests(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnLvnOdfinditemListRequests(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnNMDblclkListRequests(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnLvnGetInfoTipListRequests(NMHDR *pNMHDR, LRESULT *pResult);

	afx_msg void OnTimer(UINT_PTR nIDEvent);

	afx_msg void OnEditCopy();
	afx_msg void OnEditCopyitemid();
	afx_msg void OnEditFindRequest();
	afx_msg void OnEditAdvancedfind();
	afx_msg void OnRequestRefresh();

	afx_msg void OnFileChangelibrary();
	afx_msg void OnFileDivertrequests();
	afx_msg void OnFilePrintselected();
	afx_msg void OnFileProcessascomplete();
	afx_msg void OnFileLoginAs();

	afx_msg void OnEditUsersPick();
	afx_msg void OnEditUsersCurrent();
	afx_msg void OnEditUsersAdd();
	afx_msg void OnEditStaffPick();
	afx_msg void OnEditStaffCurrent();
	afx_msg void OnEditStaffAdd();
	afx_msg void OnEditLibraryPick();
	afx_msg void OnEditLibraryAdd();
	afx_msg void OnEditCollectionPick();
	afx_msg void OnEditCollectionAdd();
	afx_msg void OnEditPriorityPick();
	afx_msg void OnEditPriorityAdd();
	afx_msg void OnEditMethodPick();
	afx_msg void OnEditMethodAdd();
	afx_msg void OnEditStatusPick();
	afx_msg void OnEditStatusAdd();
	afx_msg void OnEditIllPick();
	afx_msg void OnEditIllAdd();

	afx_msg void OnExternallIllSendFile();
	afx_msg void OnExternalILLEditUser();
	afx_msg void OnExternalillHistory();
	afx_msg void OnExternalillFind();

	afx_msg void OnInformationLoginPage();
	afx_msg void OnInformationNewsItemMacro();

	afx_msg void OnAdminDeleterequest();
	afx_msg void OnEditPreferences();

	afx_msg void OnRequestAdd();
	afx_msg void OnRequestCheckonline();
	afx_msg void OnRequestResendemail();
	afx_msg void OnRequestNotes();
	afx_msg void OnRequestSource();
	afx_msg void OnRequestEdit();
	afx_msg void OnRequestSendtolibrary();
	afx_msg void OnRequestSendtoprocessing();
	afx_msg void OnRequestSplit();
	afx_msg void OnRequestCombine();
	afx_msg void OnRequestOpen();
	afx_msg void OnRequestClaim();
	afx_msg void OnRequestRelease();
	afx_msg void OnRequestPrintselected();
	afx_msg void OnRequestSendlink();
	afx_msg void OnRequestProcess();
	afx_msg void OnRequestMarkasheld();
	afx_msg void OnRequestManualcomplete();
	afx_msg void OnRequestNotavailable();
	afx_msg void OnRequestHistory();
	afx_msg void OnRequestResubmit();
	afx_msg void OnRecordExporttoexcel();
	afx_msg void OnSortInvoiced();

	afx_msg void OnUsersitePick();
	afx_msg void OnUsersiteCurrent();
	afx_msg void OnViewSavecolumnorder();	
	afx_msg void OnViewRequestwindow();
	afx_msg void OnViewHistorytoday();
	afx_msg void OnViewLinkslist();
	afx_msg void OnViewSourcelinkslist();
	afx_msg void OnSourceOpensource();
	afx_msg void OnSourceEditsource();

	afx_msg void OnUpdateFilePrintselected(CCmdUI *pCmdUI);
	afx_msg void OnUpdateFileProcessascomplete(CCmdUI *pCmdUI);

	afx_msg void OnUpdateEditCopy(CCmdUI *pCmdUI);
	afx_msg void OnUpdateEditCopyitemid(CCmdUI *pCmdUI);
	afx_msg void OnUpdateEditUsersCurrent(CCmdUI *pCmdUI);
	afx_msg void OnUpdateEditStaffCurrent(CCmdUI *pCmdUI);

	afx_msg void OnUpdateUsersiteCurrent(CCmdUI *pCmdUI);

	afx_msg void OnUpdateRequestCheckonline(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestResendemail(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestNotes(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestSource(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestEdit(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestSendtolibrary(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestSendtoprocessing(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestSplit(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestCombine(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestOpen(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestClaim(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestRelease(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestPrintselected(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestSendlink(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestProcess(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestMarkasheld(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestManualcomplete(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestNotavailable(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestHistory(CCmdUI *pCmdUI);
	afx_msg void OnUpdateRequestResubmit(CCmdUI *pCmdUI);
	afx_msg void OnUpdateSortInvoiced(CCmdUI *pCmdUI);
	afx_msg void OnUpdateViewRequestwindow(CCmdUI *pCmdUI);

	afx_msg void OnUpdateExternalIllEdituser(CCmdUI *pCmdUI);

// Implementation
public:
	virtual ~CCelsusView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

// Generated message map functions
protected:
	DECLARE_MESSAGE_MAP()
	BOOL SizeControls(INT cx, INT cy);

private:
	CExplorer_window m_wbRequest;
	CExplorer_window m_wbInformation;
	CExplorer_window m_wbRequester;

	CString m_szSort;
	CString m_szFilter;

	CString m_szRequestFile;
	CString m_szInformationFile;
	CString m_szRequesterFile;

	LONG m_nLower;
	LONG m_nUpper;
	LONG m_nCacheFrom;
	LONG m_nCacheTo;
	BOOL m_bResetCache;
	BOOL m_bInitialNavigate;

public:
	LONG m_nStaffID;
	BOOL m_bInitialized;
	LONGLONG m_nCurrentRecord;
	LONGLONG m_nRecordCount;
	INT m_nTicker;
	INT m_nTickerMultiplier;
	INT m_nFindTabIndex;
	BOOL m_bTimerPaused;
	BOOL m_bShowTimerCount;	
	INT m_nViewMode;
	INT m_nPrintY;
	INT m_nSortBy;
	BOOL m_bProcessComplete;

	CImageList m_ilImages;
	CTabCtrl m_ctrlTabSelection;
	CListCtrl m_ctrlRequestList;

	CDlgRequestView* m_pRequestViewDlg;

// descriptions
	CStringArray m_szaStatus;
	CStringArray m_szaPriority;
	CStringArray m_szaMethod;
	CStringArray m_szaLibrary;
	CStringArray m_szaCollection;
	CStringArray m_szaILL;
	CStringArray m_szaUserType;
	CStringArray m_szaReferrals;
	CStringArray m_szaCopyright;

// preferences
	INT m_nCurrentLibrary;
	INT m_nCurrentSort;
	BOOL m_bShowLibraryView;
	BOOL m_bShowMyView;
	BOOL m_bShowInProcessView;
	BOOL m_bShowCurrentView;
	BOOL m_bShowCompletedView;
	BOOL m_bShowHoldView;
	BOOL m_bShowTriage;
	BOOL m_bShowHighlights;
	BOOL m_bSortAscending;
	BOOL m_bHighlightDuplicate;
	BOOL m_bPrintFullCitation;
	BOOL m_bBoldEmailOnPrint;
	BOOL m_bEnableThumbnail;
	BOOL m_bShowThumbnail;
	BOOL m_bUsePrintTemplate;
	INT m_nDefaultCollection;
	BOOL m_bShowRequestWindow;

	STAFF_LOOKUP m_StaffInfo;
	ARTICLE_REQUEST m_CurrentRequest;

	CArray <STAFF_LOOKUP> m_aStaffInfo;
	CArray <USER_LOOKUP> m_aUserInfo;
	CArray <LIBRARY_LOOKUP> m_aLibrary;
	CArray <PRIORITY_LOOKUP> m_aPriority;
	CArray <METHOD_LOOKUP> m_aMethod;
	CArray <COLLECTION_LOOKUP> m_aCollection;
	CArray <STATUS_LOOKUP> m_aStatus;
	RequestMap m_mRequestSet;

public:
	CWnd* GetFocusClass(LPCTSTR WinClass);
	void SetClipboardMenu(CCmdUI* pCmdUI);
	void DoClipboardOp(INT ID);
	void CmdRouteMenu(CWnd* pWnd,CMenu* pPopupMenu);
	BOOL GetStaff(void);
	BOOL GetUsers(void);
	BOOL GetPriorities(void);
	BOOL GetLibraries(void);
	BOOL GetCollections(void);
	BOOL GetMethods(void);
	BOOL GetStatuses(void);
	BOOL GetDescriptions(void);	
	BOOL RefreshList(INT nLevel = 0);
	BOOL GetItemHighlight(LONGLONG nItemId, INT nColumn, LPCOLORREF pclrText, LPCOLORREF pclrTextBk, PINT pnWeight, PBOOL pbItalic, PBOOL pbUnderline);
	INT GetItemImage(LONGLONG nItemId, INT nColumn);
	HCURSOR GetItemCursor(LONGLONG nItemId, INT nColumn);
	BOOL PauseTimer(BOOL bPause=TRUE);
	INT ShowTabView(INT nTab, BOOL bShow = TRUE);
	void SetTabView(INT nTab);
	INT GetTabView(void);
	void SetColumTitle(INT nColumn, CString szText);
	void SetTabTitle(INT nTab, CString szAdd, BOOL bRestore = FALSE);
	BOOL GetColumnOrder(void);
	BOOL SetColumnOrder(void);
	INT GetColumnID(void);
	INT GetColumnID(CPoint point);
	LONGLONG UpdateRequestArray(BOOL bUseHints=FALSE);
	BOOL UpdateRequestDetail(void);
	BOOL FormatCurrentMacros(CString* pszString);
	BOOL ShowRequestDlg(BOOL bShow);
	BOOL LoadItemIcons(void);
};

#ifndef _DEBUG  // debug version in CelsusView.cpp
inline CCelsusDoc* CCelsusView::GetDocument() const
   { return reinterpret_cast<CCelsusDoc*>(m_pDocument); }
#endif

